//
//  LoginService.m
//  ProjectForCustomer
//
//  Created by 钟游 on 2019/8/25.
//  Copyright © 2019年 钟游. All rights reserved.
//

#import "LoginService.h"
@implementation LoginService
#pragma mark -- 用户协议
+(void)loginServiceDelegateSuccess:(void(^)(NSDictionary * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/loginLicense" requestMeth:@"GET" info:@{} sucess:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"]integerValue]==0) {
            success(responseObject[@"data"]);
        }
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 获取验证码
+(void)loginServiceCheckCodeWithphoneNumber:(NSString*)phoneNumber Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/common/getVerificationCode" requestMeth:@"POST" info:@{@"phone":phoneNumber} sucess:^(NSDictionary * _Nonnull responseObject) {
        if([responseObject[@"msg"]isEqualToString:@"发送成功"]){
            success(@"success");
        }
    } failure:^(NSString * _Nonnull error_) {
        failure(error_);
    }];
}
#pragma mark -- 退出登录
+(void)loginServiceLogoutSuccess:(void(^)(NSDictionary * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/common/getVerificationCode" requestMeth:@"POST" info:@{} sucess:^(NSDictionary * _Nonnull responseObject) {
        
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 登录
+(void)loginServiceLoginWithInfo:(NSDictionary*)info Success:(void(^)(NSDictionary * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/phoneLogin" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 第三方登录
+(void)loginServiceThirdLoginWithInfo:(NSDictionary*)info Success:(void(^)(NSDictionary * info))success failure:(void(^)(NSString * failStr))failure;
{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/thirdLoginByAccessToken" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"]integerValue]==0) {
            NSDictionary * dict = responseObject[@"data"];
            success(dict);
        }else{
            failure(@"failure");
        }
    } failure:^(NSString * _Nonnull error_) {
        failure(error_);
    }];
}
#pragma mark -- 绑定手机号
+(void)loginServiceBindPhoneWithInfo:(NSDictionary*)info Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/bindPhone" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 输入登录昵称
+(void)loginServiceNicknameWithInfo:(NSDictionary*)info Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/enterNick" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 完善个人信息
+(void)loginServicePersonalInfoWithInfo:(NSDictionary*)info Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/enterUserInfo" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 极光推送设备绑定
+(void)loginServiceBindJPushDeviceWithInfo:(NSDictionary*)info Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/activateDevice" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 标签列表
+(void)loginServiceTagListWithInfo:(NSDictionary*)info Success:(void(^)(TagListModel * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/tagList" requestMeth:@"GET" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"]integerValue]==0) {
            NSDictionary * dict = responseObject[@"data"];
            if ([dict isKindOfClass:[NSDictionary class]]) {
                TagListModel * model =[[TagListModel alloc]init];
                NSMutableArray * items =[NSMutableArray new];
                model.hasNexPage = dict[@"hasNexPage"];
                model.pageSize =dict[@"pageSize"];
                model.pageIndex = dict[@"pageIndex"];
                model.totalCount=dict[@"totalCount"];
                NSArray *  tagInfoDetails = dict[@"tagInfoDetails"];
                for (NSDictionary * dict in tagInfoDetails) {
                    AddInfoModel * models =[[AddInfoModel alloc]initWithDictionary:dict error:nil];
                    [items addObject:models];
                }
                model.tagInfoDetails =(NSArray<Optional,AddInfoModel>*)items;
                success(model);
            }
        }
    } failure:^(NSString * _Nonnull error_) {
        failure(error_);
    }];
}
#pragma mark -- 绑定导演列表
+(void)loginServiceDirectorListWithInfo:(NSDictionary*)info Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/enterFavouriteDirector" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"]integerValue]==0) {
            NSString * dict = responseObject[@"msg"];
            success(dict);
        }else{
            failure(@"failure");
        }
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 绑定演员列表
+(void)loginServiceActorListWithInfo:(NSDictionary*)info Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/enterFavouriteActor" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"]integerValue]==0) {
            NSString * dict = responseObject[@"msg"];
            success(dict);
        }else{
            failure(@"failure");
        }
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 绑定演员列表
+(void)loginServiceMoveTypeListWithInfo:(NSDictionary*)info Success:(void(^)(NSString * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/enterFavouriteMovieType" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"]integerValue]==0) {
            NSString * dict = responseObject[@"msg"];
            success(dict);
        }else{
            failure(@"failure");
        }
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 地区列表
+(void)loginServiceLocationListWithInfo:(NSDictionary*)info Success:(void(^)(NSArray * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/login/locationList" requestMeth:@"POST" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        
    } failure:^(NSString * _Nonnull error_) {
        
    }];
}
#pragma mark -- 广告图
+(void)loginServiceADListWithInfo:(NSDictionary*)info Success:(void(^)(NSDictionary * info))success failure:(void(^)(NSString * failStr))failure;{
    [[BaseHttpManager defaultManager]requestWitAPI:@"/start/startPageAd" requestMeth:@"GET" info:info sucess:^(NSDictionary * _Nonnull responseObject) {
        if ([responseObject[@"code"]integerValue]==0) {
            NSDictionary * dict = responseObject[@"data"];
            success(dict);
        }else{
            failure(@"failure");
        }
    } failure:^(NSString * _Nonnull error_) {
        failure(error_);
    }];
}
@end
